﻿<cfsilent>
	<cfscript>
		
		sessionAdvice = getProperty("serviceFactory").getBean("sessionAdvice");
		
		taskProp = getProperty("serviceFactory").getBean("taskPropertyAdvice");
		
		termId = event.getArg("TID");
		depId = sessionAdvice.getUserProp("teacherDepartment");
		
		taskIdCanceled = event.getArg("TSKED");
		
		academicYear = event.getArg("AcademicYear");
		academicTerm = event.getArg("AcademicTerm");

		event.setArg("pageTitle", "教学任务安排 - 教学任务调整");
		
		currentTab = event.getArg("TabID", "labTask");

		rs_planTask = queryNew("CourseName");
		rs_commonTask = queryNew("CourseName");
		rs_openTask = queryNew("CourseName");
		rs_sportTask = queryNew("CourseName");
		rs_departmentEntity = queryNew("institute_id");
		
		targetArgs = structNew();
		
		if ( len(termId) ) {

			structInsert(targetArgs, "TID", termId, true);

			/* 任课单位信息 */
			sql = "SELECT institute_id, institute_name 
					FROM t_institute 
					WHERE institute_id = :instituteID ";
			queryObj = new query( datasource=application.dnsSlave );
			queryObj.addParam( name="instituteID", value=depID, cfsqltype="cf_sql_varchar" );
			rs_departmentEntity = queryObj.execute( sql=sql ).getResult();
		
			/* 读取选课学期教学任务 */
			sql = "SELECT 
						t_course.course_name, 
						t_task.cidx, 
						a.tch_name tch_name, 
						t_task.task_limite, 
						t_task.task_chooesd, 
						t_task.task_capacity, 
						t_campus.campus_name, 
						t_task.task_week, 
						t_task.task_period, 
						t_institute.institute_name, 
						t_task.task_prop, 
						t_task.tsk_id, 
						b.tch_name sec_name, 
						c.tch_name ace_name 
					FROM 
						t_task 
						INNER JOIN t_course ON t_course.cid = t_task.cid 
						INNER JOIN t_teacher a ON a.tch_id = t_task.tch_id 
						INNER JOIN t_campus ON t_campus.campus_id = t_task.campus_id 
						INNER JOIN t_institute ON t_institute.institute_id = t_course.institute_id 
						INNER JOIN t_teacher b ON b.tch_id = t_task.tch_id_sec 
						INNER JOIN t_teacher c ON c.tch_id = t_task.tch_id_ace 
					WHERE 
						t_task.term_id = :termId 
						AND 
						t_course.institute_id = :depId 
					ORDER BY 
						SUBSTR(t_task.task_prop, 7, 1), 
						t_course.course_name, 
						t_task.cidx ";
			queryObj = new query( datasource=application.dnsSlave );
			queryObj.addParam( name="termId", value=termId, cfsqltype="cf_sql_char" );
			queryObj.addParam( name="depId", value=depId, cfsqltype="cf_sql_varchar" );
			rs_planTask = queryObj.execute( sql=sql ).getResult();
		
										
			/*
													and 
													exists (from TaskArrange b where a.TaskID = b.TaskID and Term.TermID = :termId) 
			*/
			sql = "SELECT 
						t_course.course_name, 
						t_common_task.cidx, 
						a.tch_name tch_name, 
						t_common_task.task_limite, 
						t_common_task.task_chooesd, 
						t_common_task.task_capacity, 
						t_campus.campus_name, 
						t_common_task.task_week, 
						t_common_task.task_period, 
						t_institute.institute_name, 
						t_common_task.task_prop, 
						t_common_task.tsk_id, 
						b.tch_name sec_name, 
						c.tch_name ace_name 
					FROM 
						t_common_task 
						INNER JOIN t_course ON t_course.cid = t_common_task.cid 
						INNER JOIN t_teacher a ON a.tch_id = t_common_task.tch_id 
						INNER JOIN t_campus ON t_campus.campus_id = t_common_task.campus_id 
						INNER JOIN t_institute ON t_institute.institute_id = t_course.institute_id 
						INNER JOIN t_teacher b ON b.tch_id = t_common_task.tch_id_sec 
						INNER JOIN t_teacher c ON c.tch_id = t_common_task.tch_id_ace 
					WHERE 
						t_common_task.term_id = :termId 
						AND 
						t_course.institute_id = :depId 
					ORDER BY 
						SUBSTR(t_common_task.task_prop, 7, 1), 
						t_course.course_name, 
						t_common_task.cidx ";
			queryObj = new query( datasource=application.dnsSlave );
			queryObj.addParam( name="termId", value=termId, cfsqltype="cf_sql_char" );
			queryObj.addParam( name="depId", value=depId, cfsqltype="cf_sql_varchar" );
			rs_commonTask = queryObj.execute( sql=sql ).getResult();
			
			/*
													and 
													exists (from TaskArrange b where a.TaskID = b.TaskID and Term.TermID = :termId) 
			*/
			
			sql = "SELECT 
						t_course.course_name, 
						t_sport_task.cidx, 
						a.tch_name tch_name, 
						t_sport_task.task_limite, 
						t_sport_task.task_chooesd, 
						t_sport_task.task_capacity, 
						t_campus.campus_name, 
						t_sport_task.task_week, 
						t_sport_task.task_period, 
						t_institute.institute_name, 
						t_sport_task.task_prop, 
						t_sport_task.tsk_id, 
						b.tch_name sec_name, 
						c.tch_name ace_name 
					FROM 
						t_sport_task 
						INNER JOIN t_course ON t_course.cid = t_sport_task.cid 
						INNER JOIN t_teacher a ON a.tch_id = t_sport_task.tch_id 
						INNER JOIN t_campus ON t_campus.campus_id = t_sport_task.campus_id 
						INNER JOIN t_institute ON t_institute.institute_id = t_course.institute_id 
						INNER JOIN t_teacher b ON b.tch_id = t_sport_task.tch_id_sec 
						INNER JOIN t_teacher c ON c.tch_id = t_sport_task.tch_id_ace 
					WHERE 
						t_sport_task.term_id = :termId 
						AND 
						t_course.institute_id = :depId 
					ORDER BY 
						SUBSTR(t_sport_task.task_prop, 7, 1), 
						t_course.course_name, 
						t_sport_task.cidx ";
			queryObj = new query( datasource=application.dnsSlave );
			queryObj.addParam( name="termId", value=termId, cfsqltype="cf_sql_char" );
			queryObj.addParam( name="depId", value=depId, cfsqltype="cf_sql_varchar" );
			rs_sportTask = queryObj.execute( sql=sql ).getResult();
		
			/*
													and 
													exists (from TaskArrange b where a.TaskID = b.TaskID and Term.TermID = :termId) 
			*/
			
			sql = "SELECT 
						t_course.course_name, 
						t_reopen_task.cidx, 
						a.tch_name tch_name, 
						t_reopen_task.task_limite, 
						t_reopen_task.task_chooesd, 
						t_reopen_task.task_capacity, 
						t_campus.campus_name, 
						t_reopen_task.task_week, 
						t_reopen_task.task_period, 
						t_institute.institute_name, 
						t_reopen_task.task_prop, 
						t_reopen_task.tsk_id, 
						b.tch_name sec_name, 
						c.tch_name ace_name 
					FROM 
						t_reopen_task 
						INNER JOIN t_course ON t_course.cid = t_reopen_task.cid 
						INNER JOIN t_teacher a ON a.tch_id = t_reopen_task.tch_id 
						INNER JOIN t_campus ON t_campus.campus_id = t_reopen_task.campus_id 
						INNER JOIN t_institute ON t_institute.institute_id = t_course.institute_id 
						INNER JOIN t_teacher b ON b.tch_id = t_reopen_task.tch_id_sec 
						INNER JOIN t_teacher c ON c.tch_id = t_reopen_task.tch_id_ace 
					WHERE 
						t_reopen_task.term_id = :termId 
						AND 
						t_course.institute_id = :depId 
					ORDER BY 
						SUBSTR(t_reopen_task.task_prop, 7, 1), 
						t_course.course_name, 
						t_reopen_task.cidx ";
			queryObj = new query( datasource=application.dnsSlave );
			queryObj.addParam( name="termId", value=termId, cfsqltype="cf_sql_char" );
			queryObj.addParam( name="depId", value=depId, cfsqltype="cf_sql_varchar" );
			rs_openTask = queryObj.execute( sql=sql ).getResult();
		
			
			if ( rs_commonTask.recordCount and rs_planTask.recordCount eq 0 ) {
				currentTab = "labCommonTask";
			}
				
			if ( rs_openTask.recordCount and rs_commonTask.recordCount eq 0 and rs_planTask.recordCount eq 0 ) {
				currentTab = "labOpenTask";
			}
				
			if ( rs_sportTask.recordCount and rs_commonTask.recordCount eq 0 and rs_planTask.recordCount eq 0 and rs_openTask.recordCount eq 0 ) {
				currentTab = "labSportTask";
			}
		
		}
		
	</cfscript>
</cfsilent>

<div id="headArea">
	<div class="uiHeader uiHeaderWithImage ptm">
		<div class="clearfix uiHeaderTop">
			<div class="uiHeaderActions rfloat">
				<a class="uiButton" href="<cfoutput>#buildURL('modifyStudentCourse', targetArgs)#</cfoutput>"><i class="mrs img btnList"></i><span class="uiButtonText">单个学生课表调整</span></a>
			</div>
			<div>
				<h2 class="uiHeaderTitle">
					<i class="uiHeaderImage img icon16x16 application"></i><cfif len(termId)><cfoutput>#academicYear#</cfoutput>-<cfoutput>#academicTerm#</cfoutput>学期</cfif>教学任务
				</h2>
			</div>
		</div>
	</div>
</div>

<div class="UIElement">
	<ul class="senateFirstPage">
		<li>
			<div class="clearfix" id="summary">
				
				<cfif termId eq "">
					<!-- termSelector -->
					<cfoutput>#event.getArg("termSelector")#</cfoutput>
					<!-- /termSelector -->
				</cfif>
				
				<cfif len(termId)>
					<div class="UItab">
						<div class="tabLables">
							<cfif rs_planTask.recordCount>
								<span <cfif currentTab eq "labTask">class="active"</cfif> id="labTask" tabTarget="Task">计划课程教学任务</span>
							</cfif>
							<cfif rs_commonTask.recordCount>
								<span <cfif currentTab eq "labCommonTask">class="active"</cfif> id="labCommonTask" tabTarget="CommonTask">全校通选课</span>
							</cfif>
							<cfif rs_openTask.recordCount>
								<span <cfif currentTab eq "labOpenTask">class="active"</cfif> id="labOpenTask" tabTarget="OpenTask">单开班教学任务</span>
							</cfif>
							<cfif rs_sportTask.recordCount>
								<span <cfif currentTab eq "labSportTask">class="active"</cfif> id="labSportTask" tabTarget="SportTask">体育项目</span>
							</cfif>
						</div>
					</div>
					<script language="javascript" type="text/javascript">
						//<![CDATA[
						<!--
						$(document).ready(function() {
						
							/* init Tab */
							$("div.tabContent").hide();
							$("div#" + $("div.tabLables span.active").attr("tabTarget")).show();
					
							$("div.tabLables > span").click(function(){
								var $targetID = $(this).attr("tabTarget");
							
								$("div.tabLables span").removeClass("active");
								$(this).addClass("active");
							
								$("div.tabContent").not('[id="' + $targetID + '"]').hide();
								$("div.tabContent#" + $targetID).show();
							});
					
						});
						// -->
						//]]>
					</script>
				
					<div id="Task" class="tabContent">
					
						<cfif rs_departmentEntity.recordCount GT 0>
							<cfset structInsert(targetArgs, "DepID", rs_departmentEntity.institute_id, true) />
							<div class="noticeBlock">
								<div class="operation">
									<a class="uiButton" href="<cfoutput>#buildURL('taskChooserflush', targetArgs)#</cfoutput>"><i class="mrs img btnList"></i><span class="uiButtonText">重新计算已选人数</span></a>
									<a class="uiButton uiButtonSpecial" href="<cfoutput>#buildURL('taskDownloadExcel', targetArgs)#</cfoutput>"><i class="mrs img btnDownload"></i><span class="uiButtonText">下载学院教学任务</span></a>
								</div>
								<h3><cfoutput>#rs_departmentEntity.institute_name#</cfoutput></h3>
								<p>
									<span class="img icon16x16 message"></span>
									<em><cfoutput>#academicYear#</cfoutput>-<cfoutput>#academicTerm#</cfoutput></em>学期, 
									需承担计划课程教学任务 <em><cfoutput>#rs_planTask.recordCount#</cfoutput></em> 个
									.
								</p>
								<hr/>
							</div>
						</cfif>
					
						<cfif rs_planTask.recordCount>
							<table class="UIEditable">
								<thead>
									<tr>
										<td width="30"></td>
										<td>校区</td>
										<td>课程</td>
										<td>教师</td>
										<td width="35">周次</td>
										<!---<td width="36">周学时</td>--->
										<td align="center" width="55">人数</td>
										<td width="25">上限</td>
										<td width="110">调整任务计划人数</td>
										<td width="18"></td>
									</tr>
								</thead>
								<tbody>
									<cfset row = 0 />
									<cfloop query="rs_planTask">
										<cfset row++ />
									
										<cfset structInsert(targetArgs, "TSK", rs_planTask.tsk_id, true) />
										<cfset structInsert(targetArgs, "TT", "P", true) />
									
										<cfset taskProp.parseProperty( rs_planTask.task_prop ) />
									
										<tr class="editRows <cfif taskIdCanceled eq rs_planTask.tsk_id>alertRow</cfif> <cfif taskProp.getCancel()>cancelRow</cfif>" rowid="<cfoutput>#rs_planTask.tsk_id#</cfoutput>">
											<td class="index">P.<cfoutput>#row#</cfoutput></td>
											<td><cfoutput>#rs_planTask.campus_name#</cfoutput></td>
											<td>
												<cfif taskProp.getCancel()>
													<span class="numeric">[<cfoutput>#rs_planTask.cidx#</cfoutput>]</span><cfoutput>#rs_planTask.course_name#</cfoutput>
												<cfelse>
													<span class="numeric">[<cfoutput>#rs_planTask.cidx#</cfoutput>]</span><a href="<cfoutput>#buildURL('taskClassDetail', targetArgs)#</cfoutput>"><cfoutput>#rs_planTask.course_name#</cfoutput></a>
												</cfif>
											</td>
											<td>
												<cfoutput>#rs_planTask.tch_name#</cfoutput>
												<cfif rs_planTask.tch_name neq rs_planTask.sec_name> / <cfoutput>#rs_planTask.sec_name#</cfoutput></cfif>
												<cfif rs_planTask.sec_name neq rs_planTask.ace_name and rs_planTask.tch_name neq rs_planTask.ace_name> / <cfoutput>#rs_planTask.ace_name#</cfoutput></cfif>
											</td>
											<td><span class="numeric"><cfoutput>#rs_planTask.task_week#</cfoutput></span></td>
											<!---<td align="center"><span class="numeric"><cfoutput>#task[9]#</cfoutput></span></td>--->
											<td align="center"><span class="numeric"><cfoutput>#rs_planTask.task_chooesd#</cfoutput> / </span><span filed="planSize" class="numeric" rowid="<cfoutput>#rs_planTask.tsk_id#</cfoutput>"><cfoutput>#rs_planTask.task_limite#</cfoutput></span></td>
											<td align="center"><cfif rs_planTask.task_capacity><span class="numeric"><cfoutput>#rs_planTask.task_capacity#</cfoutput></span><cfelse>-</cfif></td>
											<cfif taskProp.getCancel()>
													<td colspan="2">已撤班</td>
												<cfelse>
													<td>
														<a href="javascript:resize('<cfoutput>#rs_planTask.tsk_id#</cfoutput>','P',10)" class="btn increase">+10</a>
														<a href="javascript:resize('<cfoutput>#rs_planTask.tsk_id#</cfoutput>','P',-10)" class="btn decrease">-10</a>
														<cfif rs_planTask.task_capacity>
															<a href="javascript:maxsize('<cfoutput>#rs_planTask.tsk_id#</cfoutput>','P')" class="btn smax">Max</a>
														</cfif>
													</td>
													<td><a href="<cfoutput>#buildURL('taskClassCancel', targetArgs)#</cfoutput>" class="stat remove" title="取消教学任务"></a></td>
											</cfif>
										</tr>
									</cfloop>

								</tbody>
							</table>

						</cfif>
					
					</div>
				
					<div id="CommonTask" class="tabContent">
					
						<cfif rs_departmentEntity.recordCount GT 0>
							<cfset structInsert(targetArgs, "DepID", rs_departmentEntity.institute_id, true) />
							<div class="noticeBlock">
								<h3><cfoutput>#rs_departmentEntity.institute_name#</cfoutput></h3>
								<p>
									<span class="img icon16x16 message"></span>
									<em><cfoutput>#academicYear#</cfoutput>-<cfoutput>#academicTerm#</cfoutput></em>学期, 
									需承担计划全校通选课教学任务 <em><cfoutput>#rs_commonTask.recordCount#</cfoutput></em> 个
									.
								</p>
								<hr/>
							</div>
						</cfif>
					
						<cfif rs_commonTask.recordCount>
						
							<table class="UIEditable">
								<thead>
									<tr>
										<td width="30"></td>
										<td>校区</td>
										<td>课程</td>
										<td>教师</td>
										<td width="35">周次</td>
										<!---<td width="36">周学时</td>--->
										<td align="center" width="55">人数</td>
										<td width="25">上限</td>
										<td width="110">调整任务计划人数</td>
										<td width="18"></td>
									</tr>
								</thead>
								<tbody>
									<cfset row = 0 />
                                    <cfloop query="rs_commonTask">
									
										<cfset row++ />
									
										<cfset structInsert(targetArgs, "TSK", rs_commonTask.tsk_id, true) />
										<cfset structInsert(targetArgs, "TT", "C", true) />
									
										<cfset taskProp.parseProperty( rs_commonTask.task_prop ) />
									
										<tr class="editRows <cfif taskIdCanceled eq rs_commonTask.tsk_id>alertRow</cfif> <cfif taskProp.getCancel()>cancelRow</cfif>" rowid="<cfoutput>#rs_commonTask.tsk_id#</cfoutput>">
											<td class="index">C.<cfoutput>#row#</cfoutput></td>
											<td><cfoutput>#rs_commonTask.campus_name#</cfoutput></td>
											<td>
												<cfif taskProp.getCancel()>
													<span class="numeric">[<cfoutput>#rs_commonTask.cidx#</cfoutput>]</span><cfoutput>#rs_commonTask.course_name#</cfoutput>
												<cfelse>
													<span class="numeric">[<cfoutput>#rs_commonTask.cidx#</cfoutput>]</span><a href="<cfoutput>#buildURL('taskClassDetail', targetArgs)#</cfoutput>"><cfoutput>#rs_commonTask.course_name#</cfoutput></a>
												</cfif>
											</td>
											<td>
												<cfoutput>#rs_commonTask.tch_name#</cfoutput>
												<cfif rs_commonTask.tch_name neq rs_commonTask.sec_name> / <cfoutput>#rs_commonTask.sec_name#</cfoutput></cfif>
												<cfif rs_commonTask.sec_name neq rs_commonTask.ace_name  and rs_commonTask.tch_name neq rs_commonTask.ace_name > / <cfoutput>#rs_commonTask.ace_name #</cfoutput></cfif>
											</td>
											<td><span class="numeric"><cfoutput>#rs_commonTask.task_week#</cfoutput></span></td>
											<!---<td align="center"><span class="numeric"><cfoutput>#task[9]#</cfoutput></span></td>--->
											<td align="center"><span class="numeric"><cfoutput>#rs_commonTask.task_chooesd#</cfoutput> / </span><span filed="planSize" class="numeric" rowid="<cfoutput>#rs_commonTask.tsk_id#</cfoutput>"><cfoutput>#rs_commonTask.task_limite#</cfoutput></span></td>
											<td align="center"><cfif rs_commonTask.task_capacity><span class="numeric"><cfoutput>#rs_commonTask.task_capacity#</cfoutput></span><cfelse>-</cfif></td>
											<cfif taskProp.getCancel()>
													<td colspan="2">已撤班</td>
												<cfelse>
													<td>
														<a href="javascript:resize('<cfoutput>#rs_commonTask.tsk_id#</cfoutput>','C',10)" class="btn increase">+10</a>
														<a href="javascript:resize('<cfoutput>#rs_commonTask.tsk_id#</cfoutput>','C',-10)" class="btn decrease">-10</a>
														<cfif rs_commonTask.task_capacity>
															<a href="javascript:maxsize('<cfoutput>#rs_commonTask.tsk_id#</cfoutput>','C')" class="btn smax">Max</a>
														</cfif>
													</td>
													<td><a href="<cfoutput>#buildURL('taskClassCancel', targetArgs)#</cfoutput>" class="stat remove" title="取消教学任务"></a></td>
											</cfif>
										</tr>
									</cfloop>
								</tbody>
							</table>
							
						</cfif>
					
					</div>
					
					<div id="OpenTask" class="tabContent">
						
						<cfif rs_departmentEntity.recordCount GT 0>
							<cfset structInsert(targetArgs, "DepID", rs_departmentEntity.institute_id, true) />
							<div class="noticeBlock">
								<h3><cfoutput>#rs_departmentEntity.institute_name#</cfoutput></h3>
								<p>
									<span class="img icon16x16 message"></span>
									<em><cfoutput>#academicYear#</cfoutput>-<cfoutput>#academicTerm#</cfoutput></em>学期, 
									需承担单开班教学任务 <em><cfoutput>#rs_openTask.recordCount#</cfoutput></em> 个
									.
								</p>
								<hr/>
							</div>
						</cfif>
					
						<cfif rs_openTask.recordCount>
							<table class="UIEditable">
								<thead>
									<tr>
										<td width="30"></td>
										<td>校区</td>
										<td>教学班</td>
										<td>教师</td>
										<td width="35">周次</td>
										<!---<td width="36">周学时</td>--->
										<td align="center" width="60">人数</td>
										<td width="25">上限</td>
										<td width="110">调整任务计划人数</td>
										<td width="18"></td>
									</tr>
								</thead>
								<tbody>
									<cfset row = 0 />
									<cfloop query="rs_openTask">
										<cfset row++ />
									
										<cfset structInsert(targetArgs, "TSK", rs_openTask.tsk_id, true) />
										<cfset structInsert(targetArgs, "TT", "R", true) />
									
										<cfset taskProp.parseProperty( rs_openTask.task_prop ) />
									
										<tr class="editRows <cfif taskIdCanceled eq rs_openTask.tsk_id>alertRow</cfif> <cfif taskProp.getCancel()>cancelRow</cfif>" rowid="<cfoutput>#rs_openTask.tsk_id#</cfoutput>">
											<td class="index">R.<cfoutput>#row#</cfoutput></td>
											<td><cfoutput>#rs_openTask.campus_name#</cfoutput></td>
											<td>
												<cfif taskProp.getCancel()>
													<span class="numeric">[<cfoutput>#rs_openTask.cidx#</cfoutput>]</span><cfoutput>#rs_openTask.course_name#</cfoutput>
												<cfelse>
													<span class="numeric">[<cfoutput>#rs_openTask.cidx#</cfoutput>]</span><a href="<cfoutput>#buildURL('taskClassDetail', targetArgs)#</cfoutput>"><cfoutput>#rs_openTask.course_name#</cfoutput></a>
												</cfif>
											</td>
											<td>
												<cfoutput>#rs_openTask.tch_name#</cfoutput>
												<cfif rs_openTask.tch_name neq rs_openTask.sec_name> / <cfoutput>#rs_openTask.sec_name#</cfoutput></cfif>
												<cfif rs_openTask.tch_name neq rs_openTask.ace_name> / <cfoutput>#rs_openTask.ace_name#</cfoutput></cfif>
											</td>
											<td><span class="numeric"><cfoutput>#rs_openTask.task_week#</cfoutput></span></td>
											<!---<td align="center"><span class="numeric"><cfoutput>#rs_openTask.task_period#</cfoutput></span></td>--->
											<td align="center"><span class="numeric"><cfoutput>#rs_openTask.task_chooesd#</cfoutput> / </span><span filed="planSize" class="numeric" rowid="<cfoutput>#rs_openTask.tsk_id#</cfoutput>"><cfoutput>#rs_openTask.task_limite#</cfoutput></span></td>
											<td align="center"><cfif rs_openTask.task_capacity><span class="numeric"><cfoutput>#rs_openTask.task_capacity#</cfoutput></span><cfelse>-</cfif></td>
											<cfif taskProp.getCancel()>
													<td colspan="2">已撤班</td>
													
												<cfelse>
													<td>
														<a href="javascript:resize('<cfoutput>#rs_openTask.tsk_id#</cfoutput>','R',10)" class="btn increase">+10</a>
														<a href="javascript:resize('<cfoutput>#rs_openTask.tsk_id#</cfoutput>','R',-10)" class="btn decrease">-10</a>
														<cfif rs_openTask.task_capacity>
															<a href="javascript:maxsize('<cfoutput>#rs_openTask.tsk_id#</cfoutput>','R')" class="btn smax">Max</a>
														</cfif>
													</td>
													<td><a href="<cfoutput>#buildURL('taskClassCancel', targetArgs)#</cfoutput>" class="stat remove" title="取消教学任务"></a></td>
											</cfif>
										</tr>
									</cfloop>
								</tbody>
							</table>
						</cfif>
					</div>
					
					<div id="SportTask" class="tabContent">
						
						<cfif rs_departmentEntity.recordCount GT 0>
							<cfset structInsert(targetArgs, "DepID", rs_departmentEntity.institute_id, true) />
							<div class="noticeBlock">
								<h3><cfoutput>#rs_departmentEntity.institute_name#</cfoutput></h3>
								<p>
									<span class="img icon16x16 message"></span>
									<em><cfoutput>#academicYear#</cfoutput>-<cfoutput>#academicTerm#</cfoutput></em>学期, 
									需承担体育项目 <em><cfoutput>#rs_sportTask.recordCount#</cfoutput></em> 个
									.
								</p>
								<hr/>
							</div>
						</cfif>
					
						<cfif rs_sportTask.recordCount>
							<table class="UIEditable">
								<thead>
									<tr>
										<td width="30"></td>
										<td>校区</td>
										<td>教学班</td>
										<td>教师</td>
										<td width="35">周次</td>
										<!---<td width="36">周学时</td>--->
										<td align="center" width="60">人数</td>
										<td width="25">上限</td>
										<td width="110">调整任务计划人数</td>
										<td width="18"></td>
									</tr>
								</thead>
								<tbody>
									<cfset row = 0 />
                                    <cfloop query="rs_sportTask">
										
										<cfset row++ />
									
										<cfset structInsert(targetArgs, "TSK", rs_sportTask.tsk_id, true) />
										<cfset structInsert(targetArgs, "TT", "T", true) />
									
										<cfset taskProp.parseProperty( rs_sportTask.task_prop ) />
									
										<tr class="editRows <cfif taskIdCanceled eq rs_sportTask.tsk_id>alertRow</cfif> <cfif taskProp.getCancel()>cancelRow</cfif>" rowid="<cfoutput>#rs_sportTask.tsk_id#</cfoutput>">
											<td class="index">R.<cfoutput>#row#</cfoutput></td>
											<td><cfoutput>#rs_sportTask.campus_name#</cfoutput></td>
											<td>
												<cfif taskProp.getCancel()>
													<span class="numeric">[<cfoutput>#rs_sportTask.cidx#</cfoutput>]</span><cfoutput>#rs_sportTask.course_name#</cfoutput>
												<cfelse>
													<span class="numeric">[<cfoutput>#rs_sportTask.cidx#</cfoutput>]</span><a href="<cfoutput>#buildURL('taskClassDetail', targetArgs)#</cfoutput>"><cfoutput>#rs_sportTask.course_name#</cfoutput></a>
												</cfif>
											</td>
											<td>
												<cfoutput>#rs_sportTask.tch_name#</cfoutput>
												<cfif rs_sportTask.tch_name neq rs_sportTask.sec_name> / <cfoutput>#rs_sportTask.sec_name#</cfoutput></cfif>
												<cfif rs_sportTask.tch_name neq rs_sportTask.ace_name> / <cfoutput>#rs_sportTask.ace_name#</cfoutput></cfif>
											</td>
											<td><span class="numeric"><cfoutput>#rs_sportTask.task_week#</cfoutput></span></td>
											<!---<td align="center"><span class="numeric"><cfoutput>#rs_sportTask.task_period#</cfoutput></span></td>--->
											<td align="center"><span class="numeric"><cfoutput>#rs_sportTask.task_chooesd#</cfoutput> / </span><span filed="planSize" class="numeric" rowid="<cfoutput>#rs_sportTask.tsk_id#</cfoutput>"><cfoutput>#rs_sportTask.task_limite#</cfoutput></span></td>
											<td align="center"><cfif rs_sportTask.task_capacity><span class="numeric"><cfoutput>#rs_sportTask.task_capacity#</cfoutput></span><cfelse>-</cfif></td>
											<cfif taskProp.getCancel()>
													<td colspan="2">已撤班</td>
													
												<cfelse>
													<td>
														<a href="javascript:resize('<cfoutput>#rs_sportTask.tsk_id#</cfoutput>','T',10)" class="btn increase">+10</a>
														<a href="javascript:resize('<cfoutput>#rs_sportTask.tsk_id#</cfoutput>','T',-10)" class="btn decrease">-10</a>
														<cfif rs_sportTask.task_capacity>
															<a href="javascript:maxsize('<cfoutput>#rs_sportTask.tsk_id#</cfoutput>','T')" class="btn smax">Max</a>
														</cfif>
													</td>
													<td><a href="<cfoutput>#buildURL('taskClassCancel', targetArgs)#</cfoutput>" class="stat remove" title="取消教学任务"></a></td>
											</cfif>
										</tr>
									</cfloop>
								</tbody>
							</table>
						</cfif>
					</div>
					
					<script language="javascript" type="text/javascript">
						//<![CDATA[
						<!--
						function resize(taskId, taskType, step) {
								
							var $tr = $("tr[rowid='" + taskId + "']", $(".UIEditable"));
							var $span = $("span[filed='planSize']", $tr);
								
							$.post(
									"<cfoutput>#buildURL('apiTaskPlanSizeChange')#</cfoutput>",
									{
										'TSK' : taskId,
										'TT' : taskType,
										'STP' : step,
										'seed': (new Date()).getTime()
									},
									function(data) {
										//$("#out").html(data);
										result = $.parseJSON(data);
										
										if ( result.success ) {
											$span.text( result.planSize ).addClass("changed");
										}
										
									});
						}
						
						function maxsize(taskId, taskType) {
								
							var $tr = $("tr[rowid='" + taskId + "']", $(".UIEditable"));
							var $span = $("span[filed='planSize']", $tr);
								
							$.post(
									"<cfoutput>#buildURL('apiTaskPlanSizeChange')#</cfoutput>",
									{
										'TSK' : taskId,
										'TT' : taskType,
										'STP' : 'maxsize',
										'seed': (new Date()).getTime()
									},
									function(data) {
												
										result = $.parseJSON(data);
										
										if ( result.success ) {
											$span.text( result.planSize ).addClass("changed");
										}
											
									});
										
						}
						// -->
						//]]>
					</script>
				
				</cfif>				
			</div>
		</li>
	</ul>
</div>


				
				